var api = require('../../api.js');
var date = require('../../utils/date.js');
var app = getApp();
var sliderWidth = 96; // 需要设置slider的宽度，用于计算中间位置

Page({

  /**
   * 页面的初始数据
   */
  data: {
    balance: 0.00,
    freeze: 0,
    score: 0,
    totleConsumed:0,
    score_sign_continuous: 0,
    cashlogs: undefined,
    activeIndex: 0,
    sliderOffset: 0,
    sliderLeft: 0,
    myInfo: null,
    withDrawlogs: undefined,
    depositlogs: undefined,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const that = this;
    that.setData({
      store: wx.getStorageSync('store'),
      myInfo: wx.getStorageSync('my_info')
    });
 
   
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var page = this;
    var access_token = wx.getStorageSync("access_token");
    app.request({
      url: api.user.get_blance,
      data: { userId: access_token },
      success: function (res) {
        if (res.code == 200) {
          setTimeout(function () {
            wx.hideLoading();
          }, 1000);
          setTimeout(function () {
            page.setData({
              options: {},
            });
          }, 1);
          page.setData({
            cashlogs: res.data
          })

        }
      }
    });

  },
  doneShow: function () {
    const _this = this
    const token = wx.getStorageSync('token')
    if (!token) {
      app.goLoginPageTimeOut()
      return
    }
  },



  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },




})